import request from '@/config/axios'

export interface WeChatGroupVO {
  id: number
  chatId: string
  name: string
  owner: string
  notice: string
  lastChatTime: Date
}

// 查询客户群列表
export const getWeChatGroupPage = async (params) => {
  return await request.get({ url: `/wecom/we-chat-group/page`, params })
}

// 查询企微客户列表
export const getWeGroupSimpleList = async (params) => {
  return await request.get({ url: `/wecom/we-chat-group/simple-list`, params })
}
// 查询客户群详情
export const getWeChatGroup = async (id: number) => {
  return await request.get({ url: `/wecom/we-chat-group/get?id=` + id })
}

// 新增客户群
export const createWeChatGroup = async (data: WeChatGroupVO) => {
  return await request.post({ url: `/wecom/we-chat-group/create`, data })
}

// 修改客户群
export const updateWeChatGroup = async (data: WeChatGroupVO) => {
  return await request.put({ url: `/wecom/we-chat-group/update`, data })
}

// 删除客户群
export const deleteWeChatGroup = async (id: number) => {
  return await request.delete({ url: `/wecom/we-chat-group/delete?id=` + id })
}

// 导出客户群 Excel
export const exportWeChatGroup = async (params) => {
  return await request.download({ url: `/wecom/we-chat-group/export-excel`, params })
}

// 同步客户群
export const syncChatGroup = async () => {
  return await request.post({ url: `/wecom/we-chat-group/sync-chat-group` })
}

// 获取群成员
export const getWeChatGroupMember = async (params) => {
  return await request.get({ url: `/wecom/we-chat-group-member/page`, params })
}
// 获取群成员(群消息用的)
export const getChatGroupList = async (params) => {
  return await request.get({ url: `/wecom/we-chat-group-member/simple-list`, params })
}
